 

/**
 * UI for trades
 * @author Stefan
 */
public class TradesUI {

    private RentUI rent = new RentUI();
    private OrderUI order = new OrderUI();
    private SaleUI sale = new SaleUI();

    /*
     * Start trade menu
     */
    public void start()
    {
        tradesMenu();
    }

    /*
     * Trade menu
     */
    public void tradesMenu()
    {
        boolean exit = false;
        while (!exit)
        {
            int choise = writeTradeMenu();
            if (choise == 1)
            {
                order.start();
            }
            else if (choise == 2)
            {
                rent.start();
            }
            else if (choise == 3)
            {
                sale.start();
            }
            else
            {
                exit = true;
            }
        }
    }

    /*
     * Write trade menu
     */
    private int writeTradeMenu()
    {
        System.out.println("\f *** Trade menu ***");
        System.out.println(" (1) Order");
        System.out.println(" (2) Rent");
        System.out.println(" (3) Sale");
        System.out.println(" (0) Back");

        return CommonUIFunctions.readInt("\n Make your choise: ");
    }
}
